<template>
    <div class="newsinfo-container">
      <!--大标题-->
        <h1 class="title">{{newsinfolist.title}}</h1>
        <p class="newsinfo-nav">
            <span>发表时间：{{newsinfolist.add_time}}</span>
            <span>点击：{{newsinfolist.click}}次</span>
        </p>
        <hr>
        <!--内容-->
        <div class="content" v-html="newsinfolist.content">

        </div>
    </div>
</template>

<script>
    export default {
        data(){
            return{
                newsinfolist:{},
                id:this.$route.params.id
            }
        },
        created() {
            this.getNewsInfo()
        },
        methods:{
            getNewsInfo(){
                this.$http.get('news/show',{params:{id:this.id}}).then(result =>{
                    if (result.data.status === 0){
                        this.newsinfolist = result.data.message[0];
                    }else {
                        this.$toast('加载失败')
                    }
                })
            }
        }
    }
</script>

<style lang="scss">
    .newsinfo-container {
        padding: 0 5px;
        .title {
            font-size: 16px;
            text-align: center;
            margin: 10px 0;
            color: orangered;
        }
        .newsinfo-nav {
            display: flex;
            justify-content: space-between;
            color: #26a2ff;
        }
        .content {
            img {
                width: 100%;
            }
        }
    }
</style>
